import { axiosPost } from "@/lib/http";

   
//获取当天数据
const getDayData=date=>{
    return new Promise((resolve,reject)=>{
        axiosPost({
            url:'/api/calendar/day',
            data:{
                date
            },
            success:function(data){
                resolve(data)
            },
            error:function(err){
                reject(err)
            }
            
        })
    }
)
}
//获取近期数据
const getMonthData=yearMonth=>{
    return new Promise((resolve,reject)=>{
        axiosPost({
            url:'/api/calendar/month',
            data:{
                'year-month':yearMonth
            },
            success:function(data){
                resolve(data)
            },
            error:function(err){
                reject(err)
            }
            
        })
    }
)
}
//获取当年数据
const getYearData=year=>{
    return new Promise((resolve,reject)=>{
        axiosPost({
            url:'/api/calendar/year',
            data:{
                year
            },
            success:function(data){
                resolve(data)
            },
            error:function(err){
                reject(err)
            }
            
        })
    }
)
}
export{
    getDayData,
    getMonthData,
    getYearData,
}